<!DOCTYPE html>
<html>

<head>
    <!-- <title>{$info.company}</title> -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <include file="Share:meta" />
    <style type="text/css">
    .modifyaccount {
        padding-top: 50px;
        color: #000;
    }
    
    .modifyaccount .header {
        position: fixed;
        top: 0px;
        left: 0px;
        width: 100%;
        background-color: #595757;
        height: 50px;
        display: block; z-index: 100;
    }
    
    .modifyaccount .header>div>a {
        line-height: 50px;
        font-size: 16px;
    }
    
    .modifyaccount .header>div>button {
        height: 50px;
        background-color: #595757;
        box-shadow: none;
        border: 0px;
        font-size: 16px;
    }

    .modifyaccount .form-horizontal .form-group{ border-bottom: 1px solid #cececf; padding-bottom: 0px; margin-bottom: 0px; }
    .modifyaccount .form-horizontal .form-group .control-label{ line-height: 30px; color: #595656; border-right: 1px solid #cececf; height: 50px; margin-bottom: 0px; line-height: 50px; font-weight: normal; }
    .modifyaccount .form-horizontal .form-group .form-control{ border: 0px; box-shadow: none; margin-top: 5px; font-size: 18px; height: 40px; }
    </style>
</head>
<body class="modifypage">
    <div class="container-fluid container modifyaccount" style="background-color:#fff;">
        <div id="userList" class="form-horizontal" role="form" >
            <div class="header">
                <div class="col-xs-3 textcenter">
                    <a href="/bizcard/account.html">返回</a>
                </div>
                <div class="col-xs-6 textcenter">
                    <a href="#">账号</a>
                </div>
                <div class="col-xs-3 textcenter">
                    <!-- <button type="submit" class="btn btn-info"></button> -->
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-xs-4 control-label np textcenter">姓名</label>
                <div class="col-xs-8">
                    <input type="text" name="name" id="name" class="form-control" v-model="userInfo.name" required="required" title="" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label for="name_en" class="col-xs-4 control-label np textcenter">账号余额</label>
                <div class="col-xs-8">
                    <input type="text" name="money" id="money" class="form-control" v-model="userInfo.money" title="" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label for="mobile" class="col-xs-4 control-label np textcenter">积分</label>
                <div class="col-xs-8">
                    <input type="text" name="point" id="point" class="form-control" v-model="userInfo.point" required="required" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label for="mobile" class="col-xs-4 control-label np textcenter">账户姓名</label>
                <div class="col-xs-8">
                    <input type="text" name="cardname" id="cardname" class="form-control" v-model="userInfo.cardname" required="required" title="">
                </div>
            </div>
            <div class="form-group">
                <label for="mobile" class="col-xs-4 control-label np textcenter">开户银行</label>
                <div class="col-xs-8">
                    <input type="text" name="bank" id="bank" class="form-control" v-model="userInfo.bank" required="required" title="">
                </div>
            </div>
            
            <div class="form-group">
                <label for="mobile" class="col-xs-4 control-label np textcenter">银行卡号</label>
                <div class="col-xs-8">
                    <input type="text" name="cardno" id="cardno" class="form-control" 
                    v-model="userInfo.cardno" required="required" />
                </div>
            </div>
            <div class="clear"></div>
            <div class="line"></div>
            <button type="button" class="btn btn-success margin_top50" 
                style="width: 100%;border: 1px solid #ccc;"v-on:click="updateUserInfo()">保存</button>
            <button type="button" class="btn btn-warning margin_top20" 
                style="width: 100%;"  @click="tixian()">提现</button>
        </div>
    </div>
</body>
<include file="Share:toast" />
<script type="text/javascript">
    $(function(){

    });

    var HjVue = new Vue({
        el: '#userList',
        data: {
            userInfo:{
                'cid' : '{$info.cid}',
                'name' : '{$info.name}',
                'money' :'{$info.money}',
                'point' : '{$info.point}',
                'cardname' : '{$info.cardname}',
                'bank' : '{$info.bank}',
                'cardno': '{$info.cardno}'
            }
        },
        methods:{
            loadData: function(){
                alert(2);
            },
            updateUserInfo: function(){
                if (this.userInfo.bank==''){
                    toast('请填写开户行','warn');
                    return;
                }
                if (this.userInfo.cardname==''){
                    toast('请填写账号姓名','warn');
                    return;
                }
                if (this.userInfo.cardno==''){
                    toast('请填写银行卡号','warn');
                    return;
                }
                
                $.ajax({
                    type: "POST",
                    url: "/Api/updateUserInfo",
                    data: this.userInfo,
                    dataType: "json",
                    success: function(result, opt){
                        if (result.status=='1'){
                           toast('保存成功','success');

                        }else{
                            alert('保存失败');
                        }
                    },
                    error: function(){
                        alert('保存失败');
                    }
                });
            },
            tixian: function(){
                if (this.userInfo.bank==''){
                    toast('请填写开户行','warn');
                    return;
                }
                if (this.userInfo.cardname==''){
                    toast('请填写账号姓名','warn');
                    return;
                }
                if (this.userInfo.cardno==''){
                    toast('请填写银行卡号','warn');
                    return;
                }

                window.location.href = "/Bizcard/cashlist/cid/"+this.userInfo.cid;
            }
        }
    });
</script>
</html>
